<template>
	<!-- 	<view class="app l_pages">
		<jnavbar :title="'核销记录'"></jnavbar>
		<scroll-view class="page_container" scroll-y  @scrolltolower="getlist">
			
			<view class="list uni-flex-column" v-if="hasShow=='list'">
				<view class="item" v-for="(item, i) in list" :key="i">
					<view class="uni-flex-row" v-for="(data, index) in item.commodity" :key="index">
						<vimage class="img_box" :src="data.master" mode=""></vimage>
						<view class="uni-flex-column info_text">
							<text class="u-line-2">{{ data.commodity }}</text>
							<text class="sm-font">{{ data.pvs_value }}</text>
							<text class="pirce">{{ data.sell_price }}</text>
							<text>x{{ data.count }}</text>
						</view>
					</view>
					<view class="uni-flex-row uni-flex-title b_line sm-font">
						<text>订单号：</text>
						<text class="">{{ item.order_no }}</text>
					</view>
					<view class="uni-flex-row uni-flex-title b_line sm-font">
						<text>核销员编号：</text>
						<text>{{ item.assistant }}</text>
					</view>
					<view class="uni-flex-row uni-flex-title b_line sm-font">
						<text>核销时间：</text>
						<text>{{ item.accept_time }}</text>
					</view>
				</view>
			</view>
			<u-empty v-if="hasShow=='none'" text="暂无数据" mode="order"></u-empty>
		</scroll-view>
		<uni-login ref="Login" @callback="logincallback"></uni-login>
		<tab-bar ref="tabbar"></tab-bar>
		<uni-login></uni-login>
	</view> -->
	
	<view class="">
		<jnavbar :title="'核销记录'"></jnavbar>
		<me-tabs v-model="current" :tabs="tablist"></me-tabs>
		<!-- <u-gap height="20" bg-color="#F5F5F5"></u-gap> -->
		<swiper class="swiper-box" :current="current" @change="swiperChange">
			<swiper-item v-for="(tab, i) in tablist" :key="i"><ListItem ref="mescrollItem" :i="i" :index="current" :tabs="tablist" :height="height"></ListItem></swiper-item>
		</swiper>
	</view>
</template>

<script>
import {mapState, mapMutations} from 'vuex';
import ListItem from './list_item.vue';
export default {
	onShareAppMessage() {
		return this.wxShare();
	},
	data() {
		return {
			page: 1,
			list: [],
			hasShow: 'none',
			current: 0,
			height: 0,
			tablist: [
				{
					name: '商品记录',
					list: [],
					page: 1,
					isno: false,
					hasShow: 'list',
					status: 'loadmore',
					type: 1,
					a_id: -1
				}
			]
		};
	},
	computed: {
		...mapState({
			hastabbar: state => state.hastabbar,
			addons: state => state.addons
		})
	},
	components: {
		ListItem
	},
	async onLoad() {
		await this.$getWx
		this.getjuris_addons([17, 18, 19]).then(r => {
			if (r[17] || r[18]) {
				this.tablist.push({
					name: '抽奖记录',
					list: [],
					page: 1,
					isno: false,
					hasShow: 'list',
					status: 'loadmore',
					type: 2
				});
			}
			if (r[19]) {
				this.tablist.push({
					name: '积分记录',
					list: [],
					page: 1,
					isno: false,
					hasShow: 'list',
					status: 'loadmore',
					type: 3
				});
			}
		});
		if (this.addons.indexOf(17) > -1 || this.addons.indexOf(18) > -1) {
		}
		if (this.addons.indexOf()) {
		}

		this.height = uni.getSystemInfoSync().windowHeight - uni.upx2px(80) + 'px';
	},
	mounted() {
		// this.getlist();
		// var _this = this;
		// this.$nextTick(a => {
		// 	_this.$refs.tabbar.gettabs();
		// });
	},
	methods: {
		swiperChange(e) {
			this.current = e.detail.current;
		},
		logincallback() {},
		getlist() {
			let _this = this;
			this.$http('/accept/record/list?page=' + this.page + '&size=' + 10, {}, 'POST').then(res => {
				let list = res.data.msg.data;

				if (list.length > 0) {
					_this.hasShow = 'list';
					_this.list = _this.list.concat(list);
					_this.page++;
				} else {
					if (this.page == 1) {
						_this.hasShow = 'none';
					} else {
						uni.showToast({
							title: '没有更多数据了',
							icon: 'none'
						});
					}
				}
			});
		}
	}
};
</script>

<style lang="scss">
.swiper-box {
	height: calc(100vh - 80rpx);
}
</style>
